
#ifndef TMADEF_H
#define TMADEF_H

/* TMA function pointer prototype */
/**********************************/
typedef int (* PFI_TMA_CALL)(int inMeid, int inInstance, unsigned char * pucMeidDataString, unsigned short * pusLength );
void inAddFunctionTMAPointer(int inMeidID,void * pvdFunctionPointer);
int inAddTMAFunctions(void);
int inRunMEIDFunction(int inMeid, int inInstance, unsigned char * pucMeidDataString, unsigned short * pusLength );
void vdInitMonitoredItemDataFile (void);
short shGetMIData ( unsigned short fieldID, unsigned char * fieldData, unsigned short fieldBufferLength, unsigned int * fieldDataLength );
short shSetMIData ( unsigned short fieldID, unsigned char * fieldData, unsigned short dataLength );
void vdIncMICounter (unsigned short fieldID);
int inTransactionDetail (TRANSACTION_OBJECT *pobTran);
int inStartTransTimer (TRANSACTION_OBJECT *pobTran);

extern unsigned char * pucTMAFlex;

/* PUT YOUR MEID/FLEXI-RECORD_ID definitions here */
/**************************************************/
#define TMA_TEST_ID				10
#define TMA_BATCH_COUNT			11
#define TMA_MERCHANT_COUNT		12
#define TMA_INDUSTRY_TYPE		13
#define TMA_PRINTER_ERRORS		14
#define TMA_PINPAD_ERRORS		15
#define TMA_COMM_ERRORS         16
#define TMA_COMM_RETRIES        17
#define TMA_SECOND_DIALS        18
#define TMA_INCOMING_CALLS      19
#define TMA_MUST_SETTLES        20
#define TMA_APPL_ID             21
#define TMA_TRANS_PER_DAY       22
#define TMA_AVG_TRAN_AMOUNT     23
#define TMA_MAX_TRAN_AMOUNT     24
#define TMA_AVG_TRAN_TIME       25
#define TMA_SWIPES              26
#define TMA_MANUALS             27

typedef struct TagTRAN_DETAIL
{
    short   NoTrans;
    long    TotalAmount;
    long    MaxAmount;
    short   NoManuals;
    short   NoSwipes;
    long    TotalTranTime;
     
} TRAN_DETAIL;

#define MONITORED_ITEM_DATA_FILE        "monitor.dat"

#define MAX_MI_DATA_FLEXI_SIZE          300

#define MI_TRANSACTION_DETAIL_INFO      0x9801
#define MI_NO_COMM_ATTEMPTS_ERRS        0x9802
#define MI_NO_RETRIES                   0x8903
#define MI_NO_SECOND_DIALS              0x8904
#define MI_NO_INCOMING_CALLS            0x9805
#define MI_NO_MUST_SETTLES              0x8906

/* error handling macro */
#define HANDLE_ERROR(a) if (a != 0){return a;} 


#endif
